﻿using System.Web.Mvc;
using System.Web.Routing;
using Nop.Web.Framework.Mvc.Routes;

namespace Nop.Plugin.Payments.PayPalHosted
{
    public class RouteProvider : IRouteProvider
    {
        public void RegisterRoutes(RouteCollection routes)
        {
            //IPN
            routes.MapRoute("Plugin.Payments.PayPalHosted.IPNHandler",
                 "Plugins/PaymentPayPalHosted/IPNHandler",
                 new { controller = "PaymentPayPalHosted", action = "IPNHandler" },
                 new[] { "Nop.Plugin.Payments.PayPalHosted.Controllers" }
            );

            //Redirect
            routes.MapRoute("Plugin.Payments.PayPalHosted.Redirect",
                 "Plugins/PaymentPayPalHosted/Redirect",
                 new { controller = "PaymentPayPalHosted", action = "Redirect" },
                 new[] { "Nop.Plugin.Payments.PayPalHosted.Controllers" }
            );

            //FormTester
            routes.MapRoute("Plugin.Payments.PayPalHosted.FormTester",
                 "Plugins/PaymentPayPalHosted/FormTester/{id}",
                 new { controller = "PaymentPayPalHosted", action = "FormTester" },
                 new[] { "Nop.Plugin.Payments.PayPalHosted.Controllers" }
            );

            //Return handler
            routes.MapRoute("Plugin.Payments.PayPalHosted.Return",
                 "Plugins/PaymentPayPalHosted/ReturnHandler",
                 new { controller = "PaymentPayPalHosted", action = "Return" },
                 new[] { "Nop.Plugin.Payments.PayPalHosted.Controllers" }
            );
        }

        public int Priority { get { return 0; } }
    }
}